#include <iostream>
using namespace std;

// 基类
class Shape {
public:
    virtual void draw() const = 0; // 纯虚函数
    virtual ~Shape() {} // 虚析构函数
};

// 派生类
class Circle : public Shape {
public:
    void draw() const override {
        cout << "Drawing a circle." << endl;
    }
};

class Square : public Shape {
public:
    void draw() const override {
        cout << "Drawing a square." << endl;
    }
};

void drawShape(const Shape& shape) {
    shape.draw();
}

int main() {
    Circle c;
    Square s;

    drawShape(c); // 将调用 Circle 的 draw 方法
    drawShape(s); // 将调用 Square 的 draw 方法

    return 0;
}